#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <assert.h>

int removeElement(int* nums, int numsSize, int val) {
	int src = 0;
	int dst = 0;
	while (src < numsSize) {
		if (nums[src] == val) {
			src++;
		}
		else {
			nums[dst] = nums[src];
			dst++;
			src++;
		}
	}
	return dst;
}

int main()
{
	int nums[] = { 0,1,2,2,3,0,4,2 };
	int numsSize = sizeof(nums) / sizeof(nums[0]);
	int val = 2;
	int k = removeElement(nums, numsSize, val);
	
	printf("%d\n", k);
	for (int i = 0; i <k; i++)
	{
		printf("%d ", nums[i]);
	}

	return 0;
}